package com.easytouch.core.listener;

/**
 * 出货结果监听器
 * Created by gulin on 2017/8/2.
 */

public interface OnOutGoodsListener {

    public static final int RESULT_OK = 0; //出货成功
    public static final int RESULT_DETECT_FAILED = 1; //出货检测失败 只有食品机出货时才有效
    public static final int RESULT_NOGOODS_OR_BROKEN = 2; //货道无货或故障
    public static final int RESULT_LIGHT_SENSOR = 3; //光感检测不到货
    public static final int RESULT_PAY_FAILED = 4; //支付失败 只针对现金和刷卡支付方式
    public static final int RESULT_REFUND_OK = 5; //退款成功
    public static final int RESULT_TEST_OK = 7; //货道测试出货成功
    public static final int RESULT_CANCEL_OK = 8; //出货取消成功
    public static final int RESULT_TEST_FAILED = 9; //货道测试出货失败

    public static final int ERROR_NO = 0; //无错误
    public static final int ERROR_DOOR_OPEN_FAILED = 1; //取物口电机开门失败
    public static final int ERROR_DOOR_CLOSE_FAILED = 2; //取物口电机关门失败
    public static final int ERROR_DOOR_NOT_CLOSED = 3; //取物口门没闭合导致出货失败
    public static final int ERROR_CURRENT_OVERLOAD = 4; //电流过载

    /**
     * 售货机出货时触发
     * @param result 出货结果 0表示成功 其他都是失败
     * @param box 货柜
     * @param column 货道
     * @param goodsId 商品ID
     * @param price 价格
     * @param tradeTrace 流水号
     * @param machTrace 序列号
     * @param type 出货方式
     * @param errorCode 出货失败类型 只有出货结果为1时有意义
     */
    void onOutGoods(final int result, final int box, final int column, final int goodsId, final int price, final String tradeTrace, final String machTrace, final String type, final int errorCode);
}
